package com.itcast.controller;

import com.itcast.domain.Book;
import com.itcast.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


@Controller
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("/findAll")
    public ModelAndView findAll(){

        System.out.println("123");
        ModelAndView mav = new ModelAndView("success");
        mav.addObject("list",bookService.findAll());

        return mav;
    }

    @RequestMapping("/findBook")
    public ModelAndView findBook(){

        ModelAndView mav = new ModelAndView("success");
        mav.addObject("list",bookService.findBook());

        return mav;
    }


}
